//
//  SwiftUIView_Foreach.swift
//  SwiftUIPractice
//
//  Created by 不是很满意的周一 (external - Project) on 2024/9/9.
//

import SwiftUI

struct SwiftUIView_Foreach: View {
    
    let data: [String] = ["愿", "天", "堂", "没", "有", "代", "码", "到此为止了", ]
    let myString: String = "Hello"
    
    var body: some View {
        
        VStack {
            ForEach(0..<10) { index in
                HStack {
                    Circle().frame(width: 30, height: 30)
                    Text("索引编号: \(index)")
                }
            }
        }
        
        
        //下一组示例
        VStack {
            ForEach(data.indices) { index in
                Text("\(data[index]) \(index) ")
            }
        }
        
        
    }
}

#Preview {
    SwiftUIView_Foreach()
}
